package com.puzzlebazar.client.main.control;

import java.util.HashMap;

import com.google.gwt.event.logical.shared.ValueChangeHandler;

public interface HistoryController extends ValueChangeHandler<String>, GenericController, Navigation {

	/**
	 * Adds a new history state token and links it with the attached state 
	 * 
	 * @param historyToken The history token to attach the state to
	 * @param state The state to attach
	 */
	public void addHistoryToken(String historyToken, HistoryState state);
	
	/**
	 * Subclass should override to return their default state token
	 */
	public String getDefaultStateToken();
	
	public void reloadCurrentState();
	
	public void backToPreviousState();

	public void forwardToPreviousState();

	/**
	 * Build the token associated with the current stateToken and provided the given parameters
	 * 
	 * @param historyToken The state token to use
	 * @param params The list of parameters (can be null)
	 * @return The string to use as the history token
	 */
	public String buildToken(String historyToken, HashMap<String, String> params);	
}
